package clientGUI.userPanels;


import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;

import clientGUI.userPanels.Controllers.EvaluatorReportPanelController;
import clientserver.Client;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class EvaluatorReportPanel extends UPanel implements ActionListener {
	private JTextField textField;
	private JTextField textField_1;
	private JTextField textField_2;
	private JTextField textField_3;
	private JTextField textField_4;
	private JTextField textField_5;
	private EvaluatorReportPanelController c;
	private String notempty;
	private String notempty1;
	private String notempty2;
	private String notempty3;
	private String notempty4;
	private String notempty5;
	private String s;
	/**
	 * Create the panel.
	 */
	public EvaluatorReportPanel(int id, Client cl) {
		setLayout(null);
		 c = new EvaluatorReportPanelController(id,cl);
		 
		 
		JLabel lblReportAndSubmit = new JLabel("REPORT AND SUBMIT :");
		lblReportAndSubmit.setBounds(160, 0, 171, 14);
		add(lblReportAndSubmit);
		
		textField = new JTextField();
		textField.setBounds(160, 27, 86, 20);
		add(textField);
		textField.setColumns(10);
		
		textField_1 = new JTextField();
		textField_1.setColumns(10);
		textField_1.setBounds(160, 86, 267, 20);
		add(textField_1);
		
		textField_2 = new JTextField();
		textField_2.setColumns(10);
		textField_2.setBounds(160, 58, 86, 20);
		add(textField_2);
		
		textField_3 = new JTextField();
		textField_3.setColumns(10);
		textField_3.setBounds(160, 118, 267, 20);
		add(textField_3);
		
		textField_4 = new JTextField();
		textField_4.setColumns(10);
		textField_4.setBounds(160, 159, 267, 20);
		add(textField_4);
		
		textField_5 = new JTextField();
		textField_5.setColumns(10);
		textField_5.setBounds(160, 192, 267, 20);
		add(textField_5);
		
		JButton btnSubmit = new JButton("SUBMIT");
		add(btnSubmit);
		btnSubmit.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			  notempty = textField.getText();
			  notempty1 = textField_1.getText();
			  notempty2 = textField_2.getText();
			  notempty3 = textField_3.getText();
			  notempty4 = textField_4.getText();
			  notempty5 = textField_5.getText();
			 
			  if(notempty.equals("")||notempty1.equals("")||notempty2.equals("")||notempty3.equals("")||notempty4.equals("")||notempty5.equals(""))
			   {s = JOptionPane.WANTS_INPUT_PROPERTY;
			  System.out.println(s);}
			  else {
			  c.EvaluateAndSubmit(Integer.parseInt(textField.getText()), textField_1.getText(),textField_2.getText(), textField_3.getText(),textField_4.getText(),textField_5.getText());
			  }
			  
			}
			
		});
		btnSubmit.setBounds(338, 245, 89, 23);
		
		
		JLabel lblRquestId = new JLabel("Rquest id :");
		lblRquestId.setBounds(10, 33, 140, 14);
		add(lblRquestId);
		
		JLabel lblEvaluatorOfRequest = new JLabel("Evaluator of Request :");
		lblEvaluatorOfRequest.setBounds(10, 64, 140, 14);
		add(lblEvaluatorOfRequest);
		
		JLabel lblEvaluationOfThe = new JLabel("Evaluation of the request :");
		lblEvaluationOfThe.setBounds(10, 92, 140, 14);
		add(lblEvaluationOfThe);
		
		JLabel lblPossibleLosses = new JLabel("Possible Losses :");
		lblPossibleLosses.setBounds(10, 124, 140, 14);
		add(lblPossibleLosses);
		
		JLabel lblBenefit = new JLabel("Benefit :");
		lblBenefit.setBounds(10, 165, 140, 14);
		add(lblBenefit);
		
		JLabel lblChangeDescription = new JLabel("Change Description :");
		lblChangeDescription.setBounds(10, 195, 140, 20);
		add(lblChangeDescription);
		
		JButton btnMainMenu = new JButton("Main Menu");
		btnMainMenu.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) 
			{
				myframe.SetMainUserPanel();
			}
		});
		btnMainMenu.setBounds(122, 245, 89, 23);
		add(btnMainMenu);

	}

	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		
	}

}
